#ifndef __ILIB_CORE_SINGLETON_H_20120319__
#define __ILIB_CORE_SINGLETON_H_20120319__

template <class T>
class iSingleton
{
public:
	static T* instance()
	{
		if(s_instance)
			return s_instance;
		s_instance = new T();
		return s_instance;
	}

	static void destroy()
	{
		if(s_instance)
			delete s_instance;
		s_instance = NULL;
	}
private:
	static T* s_instance;
};
template<class T> T* iSingleton<T>::s_instance = NULL;
#endif  //__ILIB_CORE_SINGLETON_H_20120319__